$title Ration model

$ontext
--------------------------------------------------------------------------------
Closed 2x2 economy with unemployment using rationing instrument.
Laurent Cretegny, CoPS, Monash University, Australia, 2003.
--------------------------------------------------------------------------------
$offtext

$set path d:\prof\research\mpsge\mge2gem\examples\mpsge\ration

sets
  o                 commodity and sector          / agr, ind /
  f                 primary factor                / lab, cap /;

alias(o,s);

parameters
  sam(*,*)          benchmark social accounting matrix
  factor(f,s)       factor demand
  interm(o,s)       intermediate demand
  demand(o)         demand for consumption
  endow(f)          endowment
  tr_y(s)           tax revenue on output
  supply(s)         supply of output
  cons              aggregate consumption
  t_y(s)            tax rate on output
  t_y_l(s)          power of tax on output;

$call gdxxrw i=%path%\ration.xls o=%path%\ration.gdx index=declare
$gdxin %path%\ration.gdx
$load sam = sam
$gdxin

factor(f,s) = sam(f,s);
interm(o,s) = sam(o,s);
demand(o) = sam(o,"ra");
endow(f) = sam("ra",f);
tr_y(s) = sam("ty",s);
supply(s) = sum(o, interm(o,s)) + sum(f, factor(f,s)) + tr_y(s);
cons = sum(o, demand(o));
t_y(s) = tr_y(s) / supply(s);
t_y_l(s) = 1 - t_y(s);

$ontext
$model:ration

$sectors:
  y(s)              ! production
  c                 ! aggregate consumption

$commodities:
  p(o)              ! price of commodity
  pc                ! price of aggregate consumption
  pf(f)             ! price of primary factor

$consumers:
  ra                ! representative agent income

$auxiliary:
  upl               ! unemployment index

$prod:y(s)          s:0.0               va:1.0
  o:p(s)            q:supply(s)         p:t_y_l(s)      a:ra          t:t_y(s)
  i:pf(f)           q:factor(f,s)       va:
  i:p(o)            q:interm(o,s)

$prod:c             s:1.0
  o:pc              q:cons
  i:p(o)            q:demand(o)

$demand:ra
  d:pc              q:cons
  e:pf(f)           q:endow(f)
  e:pf("lab")       q:-endow("lab")     r:upl

$constraint:upl
  pf("lab") / pc =e= 1;

$report:
  v:r_cons(o)       i:p(o)              prod:c

$offtext
$sysinclude mpsgeset ration

* Initial levels on auxiliary variables

upl.lo = -inf;
upl.l = 0;

* Benchmark replication

ration.iterlim = 0;
$include ration.gen
solve ration using mcp;
abort$(abs(ration.objval) gt 1e-7) "*** ration does not calibrate ! ***";
ration.iterlim = 1000;

* Fixation of a numeraire to allow comparison

pc.fx = pc.l;

* Counterfactual : 10% increase in tax rate on industrial output

t_y("ind") = t_y("ind") * 1.1;

$include ration.gen
solve ration using mcp;

* Results

parameters
  res_com           results by commodity in % change from basis
  res_agg           aggregate results in % change from basis; 

res_com("output",o) = (y.l(o) - 1) * 100;
res_com("cons",o) = (r_cons.l(o)/demand(o) - 1) * 100;
res_com("price",o) = (p.l(o) - 1) * 100;

res_agg("c") = (c.l - 1 ) * 100;
res_agg("pc") = (pc.l - 1 ) * 100;
res_agg("unemploy") = upl.l;
res_agg("ra_inc") = (ra.l/cons - 1 ) * 100;

option decimals = 6;
display res_com, res_agg;
